#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>

using namespace std;

int main()
{
	int T;
	cin >> T;
	while (T--)
	{
		string a, b;
		cin >> a >> b;
		if (a == b)
		{
			cout << "Tie" << endl;
		}
		else
		{
			int x = 0, y = 0;
			if (a == "Hunter")
			{
				x = 0;
			}
			else if (a == "Bear")
			{
				x = 1;
			}
			else
			{
				x = 2;
			}
			if (b == "Hunter")
			{
				y = 0;
			}
			else if (b == "Bear")
			{
				y = 1;
			}
			else
			{
				y = 2;
			}
			if (x == (y + 1) % 3)
			{
				cout << "Player1" << endl;
			}
			else
			{
				cout << "Player2" << endl;
			}
		}
	}
	return 0;
}